using System;
using System.Collections.Generic;
using System.Text;
using IronPython.Hosting;
using Microsoft.Scripting.Hosting;
using Microsoft.Scripting;

namespace CompiledCodeDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            ScriptEngine engine = PythonEngine.CurrentEngine;
            string statements = "def sum(a, b):\n" +
                                "  return a + b\n" +
                                "first = 10\n" +
                                "second = 32\n" +
                                "print sum(first, second)\n" +
                                "print sum(first, 90)";
            CompiledCode test = engine.CreateScriptSourceFromString(statements,SourceCodeKind.File).Compile();
            ScriptScope defaultScope = engine.Runtime.Host.DefaultScope;
            test.Execute(defaultScope);
            Console.Read();

        }
    }
}
